//reservation system class declaration
#ifndef RESERVATIONSYSTEM_H_
#define RESERVATIONSYSTEM_H_

#include "flight.h"
#include "passenger.h"
#include "booking.h"
#include "itinerary.h"
#include <fstream>
using std::ifstream;
using std::ofstream;

class reservationSystem
{
	public:
		reservationSystem(); //default constructor
		//reservationSystem(const char*,const char*,const char*); //constructor
		~reservationSystem(); //destructor
		void MainMenu();
		void test();

	private:
		int addPassenger(string,string,string,string); //add a new passenger to the system
		int modifyPassenger(string,string,string,string); //modify passenger information
		int scheduleFlight(time_t,time_t,string,string); //add a new Flight
		int updateFlight(int,time_t,time_t,string,string); //update flight information
		int cancelFlight(int); //cancel flight by flight number
		int newBooking(string,int); //create a new booking for passenger and flight number
		int cancelBooking(int); //cancel booking by booking number
		int updateBooking(int,string,int); //update booking passenger and flight number
		int modifyPassportNumber(string,string);
		void listPassengerInformation(string); //list passenger information by passport number
		void listFlightInformation(int); //list flight information by flight number
		void listBookingsForFlight(int); //list bookings for a given flight number
		void listBookingsForPassenger(string); //list bookings for a given passenger
		void AirlineAgentMenu();
		void OperationsManagerMenu();
		void tokenize(const string&, vector<string>&, const string&);
		bool checkForValidPassengerData(vector<string>&);
		bool checkForValidFlightData(vector<string>&);
		bool checkForValidBookingData(vector<string>&);
		bool isNumber(string&); //check is string contains numerical data
		bool checkForValidCity(string&); //check if city is on the list of valid cities
		bool checkForValidFlight(int); //check if flight number is valid
		bool checkForValidPassenger(string&); //check if passport number is valid
		bool checkForValidBooking(int); //check if booking number is valid
		int getPassengerIndex(string&); //get index in passenger vector from passport number
		int getFlightIndex(int); //get index in flight vector from flight number
		int getBookingIndex(int); //get index in booking vector from booking number
		void listCities();
		void listBookings();
		void listFlights();
		bool compareDate(time_t, time_t);
		int searchFlight(string,string,time_t); //returns flight number if there is flight matching departure city/day, -1 otherwise
		bool checkForValidTimeFormat(string&);
		bool checkForValidPassportFormat(string);
		bool checkForValidPhoneFormat(string);
		bool checkBookingsForFlight(int);
		bool checkBookingsForPassenger(string);
		time_t getTimeObject(string&);
		static const char* passengerFile;
		static const char* flightFile;
		static const char* bookingFile;
		static const char* cityFile;
		vector<flight> all_Flights; //list of flights
		vector<passenger> passengers; //list of passengers
		vector<booking> bookings; //list of bookings
		vector<string> cities; //list of cities
		ifstream in; //input file
		ofstream out; //outut file
};

#endif
